<?php
/*
 * Recupero le informazioni dell'utente corrente
 */
$facebook = MyFacebook::getInstance();
$uid = $facebook->getUser();
echo "<h1>Il mio uid: $uid</h1>";
$me = $facebook->api('/'.FACEBOOK_APP_ID.'/insights');
if ($me) {
  echo "<code>";
  echo "<pre>".print_r($me, true)."</pre>";
  echo "</code>";
} else {
  echo "<p>Utente non loggato</p>";
}
$sql="SELECT end_time, period, api_calls, active_users, canvas_page_views FROM metrics WHERE (end_time >= ".(time()-(60*60*24)).") AND (end_time <= ".time().") AND (period = 604800)";
$arrayCall = array(
"method" => "fql.query",
"query" => $sql
);
echo $sql;
try {
  $query = $facebook->api($arrayCall);
  if ($query) {
    echo "<code>";
    echo "<pre>".print_r($query, true)."</pre>";
    echo "</code>";
  } else {
    echo "<p>Query non eseguita</p>";
  }
} catch (FacebookApiException $e) {
  echo "ERRORE: ".$e;
}
?>
<p>Documentazione Tabelle utilizzate:
<ul>
<li><a target="_blank" href="http://developers.facebook.com/docs/reference/fql/metrics">Tabella Metriche</a></li>
</ul>
</p>